import axios from 'axios';

// 定义一个函数用于获取聊天历史
export const fetchChatHistoryByDisputeId = async (disputeId) => {
    try {
        // 调用接口获取聊天记录
        const response = await axios.get(`http://10.34.78.186:18080/disputes/${disputeId}/history`);

        // 如果接口返回成功，返回数据
        if (response.data.code === 200) {
            return {
                code: 200,
                data: response.data.data,
            };
        } else {
            return {
                code: response.data.code,
                message: response.data.msg,
            };
        }
    } catch (error) {
        console.error('获取聊天记录失败:', error);
        return {
            code: 500,
            message: '服务器错误',
        };
    }
};
